﻿<Page x:Class="WpfBinding.PriorityBindingDemo"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:WpfBinding"
      mc:Ignorable="d" 
      d:DesignHeight="323" d:DesignWidth="601"
	Title="PriorityBinding">
    <Page.Resources>
        <local:AsycData x:Key="data"  FirstData="first" SecondData="second" ThirdData="third"/>
    </Page.Resources>
    <Grid   DataContext="{Binding Source={StaticResource data}}">
        <TextBlock  Height="23" HorizontalAlignment="Left" Margin="219,69,0,0" Padding="3" Background="LightBlue" Name="textBlock1" VerticalAlignment="Top" Width="137" >
            <TextBlock.Text>
                <PriorityBinding FallbackValue="Default Value">
                    <Binding Path="ThirdData"  IsAsync="True" /> 
                    <Binding Path="SecondData"  IsAsync="True"   />
                    <Binding Path="FirstData"   />
                </PriorityBinding>
            </TextBlock.Text>
        </TextBlock>
        <TextBlock Background="LightBlue" Height="23" HorizontalAlignment="Left" Margin="219,122,0,0" Name="textBlock2" Padding="3" VerticalAlignment="Top"
                   Width="137">
            <TextBlock.Text>
                       <PriorityBinding FallbackValue="Default Value">
                           <Binding IsAsync="True" Path="ThirdData" />
                           <Binding Path="FirstData" />                          
                           <Binding IsAsync="True" Path="SecondData" />
                       </PriorityBinding>
           </TextBlock.Text>
        </TextBlock>

        <TextBlock Background="LightBlue" Height="23" HorizontalAlignment="Left" Margin="219,178,0,0" Name="textBlock3" Padding="3" VerticalAlignment="Top"
                   Width="137">
            <TextBlock.Text>
                       <PriorityBinding FallbackValue="Default Value">
                           <Binding Path="FirstData" />                               
                           <Binding IsAsync="True" Path="ThirdData" />
                           <Binding IsAsync="True" Path="SecondData" />
                       </PriorityBinding>
           </TextBlock.Text>
        </TextBlock>
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="86,72,0,0" Name="textBlock4" Text="first->second-->third" VerticalAlignment="Top" Width="127" />
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="86,125,0,0" Name="textBlock5" Text="first-&gt;third" VerticalAlignment="Top" Width="127" />
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="86,178,0,0" Name="textBlock6" Text="first" VerticalAlignment="Top" Width="127" />
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="113,25,0,0" Name="textBlock7" Text="Priority Binding " Background="LightCoral" VerticalAlignment="Top" Width="243" />
    </Grid>
</Page>
